#include "SMPPDataSM.hpp"

using namespace smpp::pdu;

DataSM::DataSM(const Header &nHeader,
const CoctetString &nServiceType,
const quint8 nSourceAddrTON,
const quint8 nSourceAddrNPI,
const CoctetString &nSourceAddr,
const quint8 nDestAddrTON,
const quint8 nDestAddrNPI,
const CoctetString &nDestAddr,
const quint8 nEsmClass,
const quint8 nRegisteredDelivery,
const quint8 nDataCoding,
const MessageSubmissionRequestTLVs &nMessageSubmissionRequestTLVs):
Header(nHeader),
_ServiceType(nServiceType),
_SourceAddrTON(nSourceAddrTON),
_SourceAddrNPI(nSourceAddrNPI),
_SourceAddr(nSourceAddr),
_DestAddrTON(nDestAddrTON),
_DestAddrNPI(nDestAddrNPI),
_DestAddr(nDestAddr),
_EsmClass(nEsmClass),
_RegisteredDelivery(nRegisteredDelivery),
_DataCoding(nDataCoding),
MessageSubmissionRequestTLVs(nMessageSubmissionRequestTLVs){}

DataSM::DataSM(const DataSM &nDataSM):
Header(nDataSM),
_ServiceType(nDataSM.getServiceType()),
_SourceAddrTON(nDataSM.getSourceAddrTON()),
_SourceAddrNPI(nDataSM.getSourceAddrNPI()),
_SourceAddr(nDataSM.getSourceAddr()),
_DestAddrTON(nDataSM.getDestAddrTON()),
_DestAddrNPI(nDataSM.getDestAddrNPI()),
_DestAddr(nDataSM.getDestAddr()),
_EsmClass(nDataSM.getEsmClass()),
_RegisteredDelivery(nDataSM.getRegisteredDelivery()),
_DataCoding(nDataSM.getDataCoding()),
MessageSubmissionRequestTLVs(nDataSM){}

void DataSM::setServiceType(const CoctetString &sServiceType){
	_ServiceType = sServiceType;
}

const CoctetString &DataSM::getServiceType() const{
	return _ServiceType;
}

void DataSM::setSourceAddrTON(const quint8 nSourceAddrTON){
	_SourceAddrTON = nSourceAddrTON;
}

const quint8 DataSM::getSourceAddrTON() const{
	return _SourceAddrTON;
}

void DataSM::setSourceAddrNPI(const quint8 nSourceAddrNPI){
	_SourceAddrNPI = nSourceAddrNPI;
}

const quint8 DataSM::getSourceAddrNPI() const{
	return _SourceAddrNPI;
}

void DataSM::setSourceAddr(const CoctetString &sSourceAddr){
	_SourceAddr = sSourceAddr;
}

const CoctetString &DataSM::getSourceAddr() const{
	return _SourceAddr;
}

void DataSM::setDestAddrTON(const quint8 nDestAddrTON){
	_DestAddrTON = nDestAddrTON;
}

const quint8 DataSM::getDestAddrTON() const{
	return _DestAddrTON;
}

void DataSM::setDestAddrNPI(const quint8 nDestAddrNPI){
	_DestAddrNPI = nDestAddrNPI;
}

const quint8 DataSM::getDestAddrNPI() const{
	return _DestAddrNPI;
}

void DataSM::setDestAddr(const CoctetString &sDestAddr){
	_DestAddr = sDestAddr;
}

const CoctetString& DataSM::getDestAddr() const{
	return _DestAddr;
}

void DataSM::setEsmClass(const quint8 nEsmClass){
	_EsmClass = nEsmClass;
}

const quint8 DataSM::getEsmClass() const{
	return _EsmClass;
}

void DataSM::setRegisteredDelivery(const quint8 nRegisteredDelivery){
	_RegisteredDelivery = nRegisteredDelivery;
}

const quint8 DataSM::getRegisteredDelivery() const{
	return _RegisteredDelivery;
}

void DataSM::setDataCoding(const quint8 nDataCoding){
	_DataCoding = nDataCoding;
}

const quint8 DataSM::getDataCoding() const{
	return _DataCoding;
}

void DataSM::calcCommandLength(){
	_CommandLength = 23 + _ServiceType.size() + _SourceAddr.size() +
		_DestAddr.size() + MessageSubmissionRequestTLVs::getLength();
}
